﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DAL;
using Entetities;

namespace BLL
{
    public class SanPhamBLL
    {

        private SanPhamDAL dal;
        public SanPhamBLL()
        {
            dal = new SanPhamDAL();
        }
        public DataTable getsanpham(int manhom)
        {
            
            DataTable dt = null;
            try
            {
                dt = dal.getsanpham(manhom);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return dt;
        }


        public static DataTable Sanphamcunghang(int manhom, int masp)
        {
            SanPhamDAL spdal = new SanPhamDAL();
            return spdal.getSanPhamcunghang(manhom, masp);
        }

        public static DataTable laythongtinSP(int masp)
        {
            SanPhamDAL spdal = new SanPhamDAL();
            DataTable bang=spdal.laysanphamtheoIDsql(masp);
            return bang;          
        }

        public static DataTable getSanphamhot()
        {
            DataTable bang = null;
            try
            {
                SanPhamDAL spdal = new SanPhamDAL();
                bang = spdal.getSanPhamHot();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return bang;
        }
         public static void Update_luotxem(int masp)
        {
          SanPhamDAL spdal = new SanPhamDAL();
          spdal.updateLuotxem(masp);
         }
         public static DataTable Sesssion_luu(int masp)
         {
             SanPhamDAL spdal = new SanPhamDAL();
             return spdal.luuseesion(masp);
             
         }


        //public DataTable getListSanPham(string sqldieukien, string soluong)
        //{
        //    DataTable dt = null;
        //    try
        //    {
        //        dt = dal.getListSanPham(sqldieukien, soluong);
        //    }
        //    catch (Exception)
        //    {
        //        throw;
        //    }
        //    return dt;
        //}

    }
}
